package com.joolun.weixin.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.joolun.common.corp.TenantContext;
import com.joolun.common.utils.DateUtils;
import com.joolun.weixin.entity.ZbVideo;
import com.joolun.weixin.entity.vo.UploadResultVo;
import com.joolun.weixin.mapper.ZbVideoMapper;
import com.joolun.weixin.service.IZbVideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.function.Consumer;

/**
 * 视频库Service业务层处理
 * 
 * @author joolun
 * @date 2025-04-24
 */
@Service
public class ZbVideoServiceImpl extends  ServiceImpl<ZbVideoMapper, ZbVideo> implements IZbVideoService
{
    @Autowired
    private ZbVideoMapper zbVideoMapper;


    /**
     * 查询视频库
     * 
     * @param id 视频库主键
     * @return 视频库
     */
    @Override
    public ZbVideo selectZbVideoById(Long id)
    {
        return zbVideoMapper.selectZbVideoById(id);
    }

    /**
     * 查询视频库列表
     * 
     * @param zbVideo 视频库
     * @return 视频库
     */
    @Override
    public List<ZbVideo> selectZbVideoList(ZbVideo zbVideo)
    {
        // 添加主体id
        zbVideo.setCorpId(TenantContext.getTenantId());
        return zbVideoMapper.selectZbVideoList(zbVideo);
    }

    /**
     * 新增视频库
     * 
     * @param zbVideo 视频库
     * @return 结果
     */
    @Override
    public int insertZbVideo(ZbVideo zbVideo)
    {
        // 添加主体id
        zbVideo.setCorpId(TenantContext.getTenantId());
        zbVideo.setCreateTime(DateUtils.getNowDate());
        return zbVideoMapper.insertZbVideo(zbVideo);
    }

    /**
     * 修改视频库
     * 
     * @param zbVideo 视频库
     * @return 结果
     */
    @Override
    public int updateZbVideo(ZbVideo zbVideo)
    {
        zbVideo.setUpdateTime(DateUtils.getNowDate());
        return zbVideoMapper.updateZbVideo(zbVideo);
    }

    /**
     * 批量删除视频库
     * 
     * @param ids 需要删除的视频库主键
     * @return 结果
     */
    @Override
    public int deleteZbVideoByIds(Long[] ids)
    {
        return zbVideoMapper.deleteZbVideoByIds(ids);
    }

    /**
     * 删除视频库信息
     * 
     * @param id 视频库主键
     * @return 结果
     */
    @Override
    public int deleteZbVideoById(Long id)
    {
        return zbVideoMapper.deleteZbVideoById(id);
    }
}
